<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <title>编辑资料</title>
    <!-- JQuery -->
    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
    <!-- Bootstrap核心CSS和JS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $.getJSON(
                location.href + "/getData",
                {},
                function (json) {
                    if (json.statusCode !== 200) {
                        alert("获取失败！"+json.msg);
                        return false;
                    }
                    user=json.data;
                    $("#username").val(user.username);
                    $("#password").val(user.password);
                    $("#realname").val(user.realname);
                    $("#doEdit").attr("action",location.href+"/doEdit");
                }
            )
        })
    </script>
</head>
<body>
<div class="container">
    <h1 class="page-header">编辑资料</h1>

    <form id="doEdit" class="form-horizontal" role="form" action="#" method="post">
        <div class="form-group">
            <label class="col-sm-2 control-label" for="username">
                用户名：
            </label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="username" name="username">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="password">
                密码：
            </label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="password" name="password">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="checkPassword">
                确认密码：
            </label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="checkPassword" name="checkPassword">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="realname">
                真实姓名：
            </label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="realname" name="realname">
                <button class="btn btn-lg btn-primary btn-block" style="margin-top: 30px" type="submit">修改</button>
            </div>
        </div>

    </form>
</div>

</body>
</html>